
public class Main {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        //创建二叉树

        BinaryTree.TreeNode root = binaryTree.createTree();
        // 前序遍历
        binaryTree.preOrder(root);
        System.out.println();

        // 中序遍历
        binaryTree.inOrder(root);
        System.out.println();

        //后序遍历
        binaryTree.postOrder(root);
        System.out.println();

        //获取树中节点的个数：遍历思路
        binaryTree.size(root);
        System.out.println("节点的个数：遍历思路 "+ BinaryTree.nodeSize);

        //获取节点的个数：子问题的思路
        System.out.println("节点的个数：子问题的思路"+binaryTree.size2(root));

        //获取叶子节点的个数：遍历思路
        binaryTree.getLeafNodeCount1(root);
        System.out.println("叶子节点的个数：遍历思路 "+ BinaryTree.leafSize);

        //获取叶子节点的个数：子问题
        System.out.println("叶子节点的个数：子问题 "+binaryTree.getLeafNodeCount2(root));
        //获取第K层节点的个数
        System.out.println("第K层节点的个数 "+binaryTree.getKLevelNodeCount(root,3));

        //获取二叉树的高度
        System.out.println(binaryTree.getHeight(root));

        //// 检测值为value的元素是否存在
        binaryTree.preOrder( binaryTree.find(root,'B'));
        System.out.println();
        //层序遍历
        binaryTree.levelOrder(root);
        // 判断一棵树是不是完全二叉树
        System.out.println(binaryTree.isCompleteTree(root));
    }
}